package com.gxa.eloan.controller;

import com.gxa.eloan.service.AdminService;
import com.gxa.eloan.utils.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @author xyq
 */
@Controller
@CrossOrigin
public class AdminController {
    @Autowired
    private AdminService adminService;
    @RequestMapping("/login")
    @ResponseBody
    public String login(@RequestParam("name") String name,
                        @RequestParam("password") String password){
        Admin admin = adminService.login(name, MD5Util.encrypt(password));
        return (admin!=null)?"{\"status\":1}":"{\"status\":2}";
    }
}
